package com.headcaselabs.lb.common;

import java.rmi.Remote;
import java.rmi.RemoteException;
/* 
Copyright 2007, HeadCase Humanufacturing, Inc.

	Licensed under the Apache License, Version 2.0 (the "License"); you
	may not use this file except in compliance with the License. You may
	obtain a copy of the License at
	
	   http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
	implied. See the License for the specific language governing
	permissions and limitations under the License.
*/
/**
 * Director interface
 * @author Florian Leibert
 */
public interface Director extends Remote {
	public static final int PORT = 1099;
	/**
	 * Adds a Load Balanced group
	 * @param groupName
	 * @throws RemoteException
	 */
	public void addGroup(String groupName) throws RemoteException;
	/**
	 * Subscribes a client to the director.
	 * @param listener
	 * @throws RemoteException
	 */
	public void subscribe(PipeCallback listener) throws RemoteException;
	/**
	 * Unsubscribes a client from the director.
	 * @param listener
	 * @throws RemoteException
	 */
	public void unsubscribe(PipeCallback listener) throws RemoteException;
	/**
	 * Triggers a DB Poll.
	 * @throws RemoteException
	 */
	public void checkForUpdates() throws RemoteException;
	/**
	 * Resolves a LoadBalanced Query
	 * @param q
	 * @return
	 * @throws RemoteException
	 */
	public Record resolve(LBQuery q) throws RemoteException;
	/**
	 * Adds a node to the LoadBalanced group specified in groupName. If that one does not exist, it creates a new one.
	 * @param groupName
	 * @param mode
	 * @param arg
	 * @param hostname
	 * @throws RemoteException
	 */
	public void addNode(String groupName,String mode, String arg, String hostname) throws RemoteException;
	/**
	 * Dumps the database entries.
	 * @return
	 * @throws RemoteException
	 */
	public String getDBDump() throws RemoteException;
	/**
	 * Dumps information about the registered nodes.
	 * @return
	 * @throws RemoteException
	 */
	public String getServerDump() throws RemoteException;
	/**
	 * Dumps the mappings.
	 * @return
	 * @throws RemoteException
	 */
	public String getMappingDump() throws RemoteException;
}
